package com.xyy.saas.payment.cores.enums;

import lombok.Getter;

/**
 * @author liujf
 */
@Getter
public enum XydInOutTypeEnum {
    IN(1, "收入"),
    OUT(2, "支出"),
    ;
    private Integer code;

    private String name;

    XydInOutTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static String getNameByCode(Integer code) {
        if (IN.code.equals(code)) {
            return IN.name;
        } else if (OUT.code.equals(code)) {
            return OUT.name;
        } else {
            return null;
        }
    }

    public static Integer getCodeByName(String name) {
        if (IN.name.equals(name)) {
            return IN.code;
        } else if (OUT.name.equals(name)) {
            return OUT.code;
        } else {
            return null;
        }
    }

}
